<?php
/**
 * Created by PhpStorm.
 * User: Vlad
 * Date: 12/30/13
 * Time: 8:38 PM
 */

class Action
{
    public function Invoke($anonFunc)
    {
        $jsonReply = new JSONReply();

        try
        {
            $anonFunc($jsonReply);
        }
        catch (Exception $e)
        {
            $jsonReply->SetError('Exception caught: ' . $e->getMessage(), 2000);
        }

        return $jsonReply;
    }
}
